package bit.lotterysystem.common.exception;

import bit.lotterysystem.common.errorcode.ErrorCode;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;

@Data
@EqualsAndHashCode(callSuper=true)
//不写上面这句可能会出现问题
@AllArgsConstructor
@NoArgsConstructor
public class ControllerException extends RuntimeException {
    /**
     * 异常码
     * @see bit.lotterysystem.common.errorcode.ControllerErrorCodeConstants
     */
    private Integer code;
    private String message;

    public ControllerException(ErrorCode errorCode) {
        this.code=errorCode.getCode();
        this.message=errorCode.getMsg();
    }
}
